package com.work.saturn.interesting;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.immo.libcommon.base.BaseHeadActivity;
import com.immo.libcommon.utils.FullyLinearLayoutManager;
import com.work.saturn.R;
import com.work.saturn.bean.InterestDetailBean;
import com.immo.libcommon.constant.RouterUtil;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author YaoChen
 * @content 未来局下注统计
 * @date 2018/07/16
 */

@SuppressWarnings("unchecked")
@Route(path = RouterUtil.INTER_HISTORY)
public class InterestHistory extends BaseHeadActivity {
    @BindView(R.id.inter_history_list)
    RecyclerView mList;
    private List<InterestDetailBean.PayloadBeanX.PayloadBean.HistoryBean> mHistoryBeanList;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_interertinghistory);
        ButterKnife.bind(this);
        setTitle("下注统计");
        mHistoryBeanList = (List<InterestDetailBean.PayloadBeanX.PayloadBean.HistoryBean>) getIntent().getSerializableExtra("interesthistory");
        initData();
    }

    private void initData() {
        FullyLinearLayoutManager linearLayoutManagerTheme = new FullyLinearLayoutManager(this) {
            @Override
            public boolean canScrollVertically() {
                return false;
            }
        };
        linearLayoutManagerTheme.setOrientation(LinearLayoutManager.VERTICAL);
        mList.setLayoutManager(linearLayoutManagerTheme);
        InterHistoryDetailAdapter releaseDetailAdapter = new InterHistoryDetailAdapter();
        //设置适配器
        releaseDetailAdapter.bindToRecyclerView(mList);
    }


    /**
     * 资产历史列表
     */
    private class InterHistoryDetailAdapter extends BaseQuickAdapter<InterestDetailBean.PayloadBeanX.PayloadBean.HistoryBean, BaseViewHolder> {
        InterHistoryDetailAdapter() {
            super(R.layout.item_inter_history, mHistoryBeanList);
        }

        @Override
        protected void convert(BaseViewHolder helper, InterestDetailBean.PayloadBeanX.PayloadBean.HistoryBean item) {
            helper.setText(R.id.item_inter_history_name, item.getChooseOption());
            helper.setText(R.id.item_inter_history_num, item.getAmount() + "  " + item.getTokenName());
        }

    }

}
